; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=i686-- -mattr=+sse2 | FileCheck %s

define zeroext i8 @t(double %x) nounwind readnone {
; CHECK-LABEL: t:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
; CHECK-NEXT:    cvttpd2dq %xmm0, %xmm1
; CHECK-NEXT:    cvtdq2pd %xmm1, %xmm1
; CHECK-NEXT:    cmpeqsd %xmm0, %xmm1
; CHECK-NEXT:    movd %xmm1, %eax
; CHECK-NEXT:    andl $1, %eax
; CHECK-NEXT:    # kill: def $al killed $al killed $eax
; CHECK-NEXT:    retl
entry:
	%0 = fptosi double %x to i32		; <i32> [#uses=1]
	%1 = sitofp i32 %0 to double		; <double> [#uses=1]
	%2 = fcmp oeq double %1, %x		; <i1> [#uses=1]
	%retval12 = zext i1 %2 to i8		; <i8> [#uses=1]
	ret i8 %retval12
}

define zeroext i8 @u(double %x) nounwind readnone {
; CHECK-LABEL: u:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
; CHECK-NEXT:    cvttpd2dq %xmm0, %xmm1
; CHECK-NEXT:    cvtdq2pd %xmm1, %xmm1
; CHECK-NEXT:    cmpneqsd %xmm0, %xmm1
; CHECK-NEXT:    movd %xmm1, %eax
; CHECK-NEXT:    andl $1, %eax
; CHECK-NEXT:    # kill: def $al killed $al killed $eax
; CHECK-NEXT:    retl
entry:
	%0 = fptosi double %x to i32		; <i32> [#uses=1]
	%1 = sitofp i32 %0 to double		; <double> [#uses=1]
	%2 = fcmp une double %1, %x		; <i1> [#uses=1]
	%retval12 = zext i1 %2 to i8		; <i8> [#uses=1]
	ret i8 %retval12
}
